package com.hhq.sso.auth.base.service.impl;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hhq.sso.auth.base.entity.SystemUser;
import com.hhq.sso.auth.base.mapper.SystemUserMapper;
import com.hhq.sso.auth.base.service.ISystemUserService;
import com.hhq.sso.common.service.BaseServiceImpl;

/**
 * <p>
 * Description: some description
 * </p>
 *
 * @author : xiaodong.yang
 * @date : 2024/6/20 10:48
 */
@Service
public class SystemUserServiceImpl extends BaseServiceImpl<SystemUserMapper, SystemUser> implements ISystemUserService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return baseMapper.selectOne(Wrappers.lambdaQuery(SystemUser.class).eq(SystemUser::getUsername, username),
            false);
    }
}
